<template>
	<div class="cus-form-title">
		<el-divider v-if="showDivider" border-style="dotted" direction="vertical"></el-divider>
		<icon v-if="showIcon" :name="props.icon" size="var(--el-font-size-large)" style="margin: auto 10px"/>
		<span :style="labelStyle" class="label">{{ props.label }}</span>
		<slot name="after"/>
		<div style="margin-left: auto; margin-right: 10px">
			<slot name="end"/>
		</div>
	</div>
</template>

<script lang="ts" setup>
import Icon from '@/components/icon.vue'
import type {StyleValue} from 'vue'

const props = withDefaults(defineProps<{
	label?: string
	labelStyle?: StyleValue
	icon?: string
	showIcon?: boolean
	showDivider?: boolean
}>(), {
	icon: 'fa fa-edit',
	showIcon: true,
	showDivider: true
})

</script>

<style lang="scss" scoped>

.cus-form-title {
	display: flex;
	align-items: center;
	margin-bottom: 20px;
	width: 100%;

	.label {
		font-size: var(--el-font-size-large);
		font-weight: bold;
	}
}

</style>
